﻿using Microsoft.EntityFrameworkCore;
using System;

using FrameworkCore.Dependency;
using System.Linq;
using EntityFrameworkCore.Configurations;
using EntityFrameworkCore.Mapping;

namespace EntityFrameworkCore
{
   public class AuditDbContext : DbContext
    {


        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //Data Source=.;Initial Catalog=Audit;User ID=sa;Password=123
            //Server=(localdb)\\mssqllocaldb;Database=EFGetStarted.ConsoleApp.NewDb;Trusted_Connection=True;
            optionsBuilder.UseSqlServer(@"Data Source=.;Initial Catalog=Audit1;User ID=sa;Password=123;", b => b.UseRowNumberForPaging());
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
  
            base.OnModelCreating(modelBuilder);

            modelBuilder.AddEntityConfigurationsFromAssembly(GetType().Assembly);


        }

    }
}
